clear;
clc;

dir = '..\\samplesrc\\';
%filename = 'Continental Open Doors 2010 Iasi.c';
%filename = 'Mobile__test.cpp';
%filename = 'RSA_common.cpp';
%filename = 'PathFileExists function Microsoft code sample.cpp';
filename = 'classB.c';

fid = fopen([dir filename], 'r');

linecount = 0;
text = {};

while ~feof(fid)
    line = fgetl(fid);
    if line == -1
        line = '';
    end
    linecount = linecount + 1;
    text{linecount} = line;
end

fclose(fid);

clear line;

[textdensity, textcolumndensity, commentlineratio] = calctextdensity(text);

plot(100 * textcolumndensity, 'k');
title(filename);
ylabel('text column density (%)');
xlabel('');